package com.test.sshshiro.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.test.sshshiro.framework.BaseUpdatableEntity;

@Entity
@Table(name="acct_role")
public class AcctRole extends BaseUpdatableEntity {

	private String roleId;
	private String roleName;
	public String getRoleId() {
		return roleId;
	}
	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	@JsonIgnore
	@ManyToMany(fetch = FetchType.LAZY)
	@Fetch(FetchMode.SUBSELECT)
	@JoinTable(name = "acct_role_authority", joinColumns = { @JoinColumn(name = "ROLE_ID") }, inverseJoinColumns = { @JoinColumn(name = "AUTHORITY_ID") })
	private Set<AcctAuthority> authorityList = new HashSet<AcctAuthority>();
	public Set<AcctAuthority> getAuthorityList() {
		return authorityList;
	}
	public void setAuthorityList(Set<AcctAuthority> authorityList) {
		this.authorityList = authorityList;
	}
	
	
	
}
